package com.mytaobao.main.firsttab.func.headline;

import android.content.Context;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.util.AttributeSet;
import android.widget.LinearLayout;

import com.mytaobao.R;
import com.tmall.wireless.tangram.structure.BaseCell;
import com.tmall.wireless.tangram.structure.view.ITangramViewLifeCycle;

import java.util.ArrayList;

/**
 * Created by hp on 2017/7/6.
 */

public class HeadlineView extends LinearLayout implements ITangramViewLifeCycle {

    HeadLineVerticalViewPager mHeadLineVerticalViewPager;

    private Context mContext;//保存构造时传入的activity

    public HeadlineView(Context context) {
        super(context);
        init(context);
    }

    public HeadlineView(Context context, @Nullable AttributeSet attrs) {
        super(context, attrs);
        init(context);
    }

    public HeadlineView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        init(context);
    }

    private void init(Context context) {
        mContext = context;
        inflate(getContext(), R.layout.tao_bao_headline, this);
        setOrientation(VERTICAL);

        mHeadLineVerticalViewPager= (HeadLineVerticalViewPager) findViewById(R.id.vvp_headline);
        mHeadLineVerticalViewPager.setData((AppCompatActivity) mContext);
    }

    @Override
    public void cellInited(BaseCell cell) {

    }

    @Override
    public void postBindView(BaseCell cell) {
        final ArrayList<String> item1 = new ArrayList<String>() {{ add("热评"); add("穿长款大衣的时候，你穿的都是些什么鞋");  }};
        final ArrayList<String> item2 = new ArrayList<String>() {{ add("热评"); add("iphone6u也能免费换电池了，高兴不");  }};
        final ArrayList<String> item3 = new ArrayList<String>() {{ add("热评"); add("飘窗的业务别浪费了，飘窗应该都这样来装");  }};
        final ArrayList<String> item4 = new ArrayList<String>() {{ add("热评"); add("8种女生发型，分数最高在这里哟");  }};
        final ArrayList<String> item5 = new ArrayList<String>() {{ add("热议"); add("鞋子后面的小尾巴作用原来这么大!涨知识");  }};
        final ArrayList<String> item6 = new ArrayList<String>() {{ add("热议"); add("脚趾甲长到肉里了?叫你如何解决");  }};

        final ArrayList<ArrayList<String>> items1 = new ArrayList<ArrayList<String>>() {{ add(item1); add(item2); }};
        final ArrayList<ArrayList<String>> items2 = new ArrayList<ArrayList<String>>() {{ add(item3); add(item4); }};
        final ArrayList<ArrayList<String>> items3 = new ArrayList<ArrayList<String>>() {{ add(item5); add(item6); }};

        ArrayList<ArrayList<ArrayList<String>>> items = new ArrayList<ArrayList<ArrayList<String>>>(){{ add(items1); add(items2); add(items3);}};
    }

    @Override
    public void postUnBindView(BaseCell cell) {

    }
}
